package entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;

/**
 * Vente entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "vente", schema = "public")
public class Vente implements java.io.Serializable {

	// Fields

	private Integer id;
	private Evenement evenement;
	private Guichet guichet;
	private Date time;
	private Date date;
	private Integer nombre;
	private Integer prixUnitaire;
	private double prixTotal;
	private Integer remise;
	private double prixAchat;
	private Set<Billet> billets = new HashSet<Billet>(0);

	// Constructors

	/** default constructor */
	public Vente() {
	}

	/** full constructor */
	public Vente(Evenement evenement, Guichet guichet, Date time, Date date,
			Integer nombre, Integer prixUnitaire, double prixTotal,
			Integer remise, double prixAchat, Set<Billet> billets) {
		this.evenement = evenement;
		this.guichet = guichet;
		this.time = time;
		this.date = date;
		this.nombre = nombre;
		this.prixUnitaire = prixUnitaire;
		this.prixTotal = prixTotal;
		this.remise = remise;
		this.prixAchat = prixAchat;
		this.billets = billets;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_event")
	public Evenement getEvenement() {
		return this.evenement;
	}

	public void setEvenement(Evenement evenement) {
		this.evenement = evenement;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "id_gichet")
	public Guichet getGuichet() {
		return this.guichet;
	}

	public void setGuichet(Guichet guichet) {
		this.guichet = guichet;
	}

	@Column(name = "time", length = 15)
	public Date getTime() {
		return this.time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "date", length = 13)
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Column(name = "nombre")
	public Integer getNombre() {
		return this.nombre;
	}

	public void setNombre(Integer nombre) {
		this.nombre = nombre;
	}

	@Column(name = "prix_unitaire")
	public Integer getPrixUnitaire() {
		return this.prixUnitaire;
	}

	public void setPrixUnitaire(Integer prixUnitaire) {
		this.prixUnitaire = prixUnitaire;
	}

	@Column(name = "prix_total", precision = 17, scale = 17)
	public double getPrixTotal() {
		return this.prixTotal;
	}

	public void setPrixTotal(double prixTotal) {
		this.prixTotal = prixTotal;
	}

	@Column(name = "remise")
	public Integer getRemise() {
		return this.remise;
	}

	public void setRemise(Integer remise) {
		this.remise = remise;
	}

	@Column(name = "prix_achat", precision = 17, scale = 17)
	public double getPrixAchat() {
		return this.prixAchat;
	}

	public void setPrixAchat(double prixAchat) {
		this.prixAchat = prixAchat;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "vente")
	public Set<Billet> getBillets() {
		return this.billets;
	}

	public void setBillets(Set<Billet> billets) {
		this.billets = billets;
	}

}